//
//  XMGVerticalButton.m
//  01-百思不得姐
//
//  Created by xiaomage on 15/7/26.
//  Copyright (c) 2015年 小码哥. All rights reserved.
//

#import "XMGVerticalButton.h"

@interface XMGVerticalButton ()

@property (nonatomic, weak) UIView *centerContentView;

@end

@implementation XMGVerticalButton

- (void)setup
{
    self.titleLabel.textAlignment = NSTextAlignmentCenter;
    self.imageView.contentMode = UIViewContentModeCenter;
    
}

- (instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
        [self setup];
    }
    return self;
}

- (void)awakeFromNib
{
    [self setup];
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    
    // 调整图片
    self.imageView.My_X = 0;
    self.imageView.My_Y = 6;
    self.imageView.My_Width = self.My_Width;
    self.imageView.My_Height = self.imageView.image.size.height;
    
    // 调整文字
    self.titleLabel.My_X = 0;
    self.titleLabel.My_Y = self.imageView.My_Height;
    self.titleLabel.My_Width = self.My_Width;
    self.titleLabel.My_Height = self.My_Height - self.titleLabel.My_Y;
}

@end
